import request from '@/utils/request'
/**
 * 登录
 */
export function loginApi(data) {
  return request({
    url: '/frame/login',
    method: 'POST',
    data
  })
}
/**
 * 退出
 */
export function loginOutApi() {
  return request({
    url: '/frame/logout',
    method: 'POST'
  })
}
/**
 * 获取用户列表
 */
export function getUserListApi(page = 1, pagesize = 10, username = '') {
  return request({
    url: '/users',
    method: 'GET',
    params: {
      page,
      pagesize,
      username
    }
  })
}
/**
 * 获取权限组列表
 */
export function getPermissionsApi(data) {
  return request({
    url: 'permissions/simple',
    method: 'get',
    data
  })
}
/**
 * 新增成员
 */
export function addUserApi(data) {
  return request({
    url: '/users',
    method: 'post',
    data
  })
}
export function editUserApi(id, data) {
  return request({
    url: `/users/${id}`,
    method: 'put',
    data
  })
}
export function delUserApi(data) {
  return request({
    url: `/users/${data.id}`,
    method: 'delete',
    data
  })
}
/**
 * 获取用户详情
 */
export function getUserDetailApi(id) {
  return request({
    url: `/users/${id}`,
    method: 'get'
  })
}
